<form action="postnummer.php" />
	<table border="1">
    	<tr>
        	<th>postnummer:</th>
            <td><input type="text" name="postnummer" /></td>
        </tr>
        <tr>
        	<th>by</th>
            <td><input type="text" name="by" /></td>
        </tr>
<tr>

<td> <input type="submit" value="Opret" /> </td>

</tr>

</table>

</form>


<?php
	$connection = mysqli_connect("localhost","root","","Holm-adressedatabase");
	
	
	if (isset($_REQUEST["postnummer"])) {
		
	//2
	$q = "INSERT INTO postnummer 				VALUES($_REQUEST[postnummer],'$_REQUEST[by]')";
	$r = mysqli_query($connection,$q);
	
	//3	
		
	}

	//1
	$connection = mysqli_connect("localhost","root","","Holm-adressedatabase");
	//2
	$q = "select * from postnummer";
	
	$r = mysqli_query($connection,$q);
	
	//3
	while($record = mysqli_fetch_array($r)) {
		$postnummer =$record["postnummer"];
		echo "$postnummer <a href=retpostnummer.php?postnummer=$postnummer> $record[by] </a href> <br>";
	}

	echo "<a href='menu.html'>retur til hovedmenu</a href>";

?>